import config from "@/config"
import http from "@/utils/request"

export default {
    getList: {
        url: `${config.API_URL}/displayExample/list`,
        name: "获取客户案例列表",
        get: function (data = {}) {
            return new Promise((resolve, reject) => {
                http.get(this.url, data).then((response) => {
                    resolve(response)
                }).catch((error) => {
                    resolve(error.data)
                })
            })
        }
    },
    add: {
        url: `${config.API_URL}/displayExample/add`,
        name: "添加客户案例",
        post: function (data = {}) {
            return new Promise((resolve, reject) => {
                http.post(this.url, data).then((response) => {
                    resolve(response)
                }).catch((error) => {
                    resolve(error.data)
                })
            })
        }
    },
    update: {
        url: `${config.API_URL}/displayExample/update`,
        name: "修改客户案例",
        post: function (data = {}) {
            return new Promise((resolve, reject) => {
                http.post(this.url, data).then((response) => {
                    resolve(response)
                }).catch((error) => {
                    resolve(error.data)
                })
            })
        }
    },
    delete: {
        url: `${config.API_URL}/displayExample/delete`,
        name: "删除客户案例",
        post: function (data = {}) {
            return new Promise((resolve, reject) => {
                http.postParam(this.url, data).then((response) => {
                    resolve(response)
                }).catch((error) => {
                    resolve(error.data)
                })
            })
        }
    },
    isDisable: {
        url: `${config.API_URL}/displayExample/disable`,
        name: "启用/禁用数据",
        post: function (data = {}) {
            return new Promise((resolve, reject) => {
                http.postParam(this.url, data).then((response) => {
                    resolve(response)
                }).catch((error) => {
                    resolve(error.data)
                })
            })
        }
    }
}